import request from '@/utils/request'
import {getToken} from "@/utils/auth";

export function login(data) {
  return request({
    url: '/gv-kube/user/get/token',
    // url: '/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: `/gv-kube/user/get/role?token=${token}`,
    // url: '/vue-element-admin/user/info',
    method: 'post'
    // params: { token }
  })
}

export function logout(token) {
  return request({
    url: `/gv-kube/user/logout?token=${token}`,
    method: 'post'
  })
}

export function getMenu() {
  return request({
    url: '/gv-kube/role/get/menu',
    method: 'post'
  })
}

export function getUserRole() {
  return request({
    url: `/gv-kube/user/get/role?token=${getToken()}`,
    method: 'post'
  })
}

//服务注册
export function registerService(data) {
  return request({
    url: '/service/inner/serviceMetadata/register',
    method: 'post',
    data    // 这里需要传入服务注册信息
});
}
//获取已注册的服务列表**（如果后端支持）
export function getServiceList() {
  return request({
    url: '/service/inner/serviceMetadata/register', // 确保后端提供该 API
    method: 'post'
  });
}
